<?php
/**
 * RUBIK IT Solution & Development ltd.
 *
 * PROJECT		: Rubik Ultimate
 * @version 	: 1.1
 * COPYRIGHT	: 2008
 * ------------------------------------------------------
 * 
 * [GENERAL INFO OF THIS FILE] 
 *
 * @author			loclx <loclx@rubik.com.vn>
 * @access			[public/private]
 * @package		 [package name]
 *
 * Created on	:Dec 1, 2008
 */

// no direct access
defined ( '_FW_EXEC' ) or die ( 'Restricted access' );

RCoreImporter::cls('html.fieldInfo.AbstractHtmlFieldInfo');

class RichTextHtmlFieldInfo extends AbstractHtmlFieldInfo {
	var $_width = '100%';
	var $_height = 400;	
			
	/**
	 * Constructor
	 *
	 * @param string $basicName
	 */
	function __construct($basicName) {
		parent::__construct($basicName);				
	}

	/**
	 * Set the size of box
	 *
	 * @param mixed $widht
	 * @param mixed $height
	 */
	function setSize($widht, $height) {
		$this->_width = $widht;
		$this->_height = $height;
	}
	
	/**
	 * Function for geting the html for inputing data
	 *
	 * @abstract 
	 * @return string
	 */
	function getHtmlInputData($dataType = '', $extAttribute = '') {
		//$extAttribute .= $this->buildValidateHtmlAttribute($dataType);					
		RCoreImporter::cls( "html.HtmlEditor" );
		$eContent = new HtmlEditor ( $this->_fieldName );								
//		return $eContent->createEditor ( $this->_value, $width, $height );
		return $eContent->createEditor ( $this->_value, $this->_width, $this->_height );
	}		
	
	/**
	 * Function for geting the html for inputing data
	 * NOTE: please override in case special treat
	 * 
	 * @return string
	 */
	function getHtmlFilterData($dataType = '', $extAttributes = '') {
		$extAttributes .= $this->buildValidateHtmlAttribute($dataType);
		$value = htmlspecialchars($this->_value);
		$inputHtml = "<input type=\"text\" {$extAttributes} name=\"{$this->_fieldName}\" id=\"{$this->_fieldName}\" value=\"{$value}\"/>";
		return $inputHtml;
	}
}
?>
